#/bin/bash

# AMyCMS - Asterisk and MySQL Cluster Management Suite
# This script is part of the Asterisk and MySQL Cluster configuration and management suite for Debian Lenny
# Please see the README for more info
# This script installs and configures heartbeat for Debian Lenny
#
# Copyright Phil Haddad 2009


# you need to scp this script (along with all other AMyCMS scripts)
# to each cluster node before running them

# configure these variables
node1="asterisk1"
node2="asterisk2"
node3="asterisk3"
node4="asterisk4"
virtual_ip=192.168.70.140

apt-get install heartbeat

echo "
auth 3
3 md5 randommd5string
" >> /etc/ha.d/authkeys

echo "
keepalive 2
deadtime 10
udpport 694
udp eth0
logfacility local0
node $node1
node $node2
node $node3
node $node4
" >> /etc/ha.d/ha.cf

echo "
$node1 $virtual_ip
" >> /etc/ha.d/haresources

/etc/init.d/heartbeat start

ip addr sh eth0
